<template>
  <PageMain :before-back="titleBeforeBack">
    <template #header> </template>
    <template #body>
      <div class="p-[20px] flex flex-col justify-between items-end w-full h-full bg-white">
        <a-form :model="formData" layout="vertical">
          <a-row :span="24" :gutter="[24, 12]">
            <a-col :span="8">
              <a-form-item required label="主体名称" name="name">
                <a-input v-model:value="formData.name" />
              </a-form-item>
            </a-col>
            <a-col :span="8">
              <a-form-item required label="类型" name="type">
                <a-select v-model:value="formData.type" placeholder="请选择">
                  <a-select-option value="总公司">总公司</a-select-option>
                  <a-select-option value="分公司">分公司</a-select-option>
                  <a-select-option value="外部企业">外部企业</a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :span="8"> </a-col>
          </a-row>
          <a-row :span="24" :gutter="[24, 12]">
            <a-col :span="8">
              <a-form-item required label="统一社会信用代码" name="credit_code">
                <a-input v-model:value="formData.credit_code" />
              </a-form-item>
            </a-col>
            <a-col :span="8">
              <a-form-item required label="联系人" name="contact_user_name">
                <a-input v-model:value="formData.contact_user_name" />
              </a-form-item>
            </a-col>
            <a-col :span="8">
              <a-form-item required label="联系电话" name="contact_user_phone">
                <a-input v-model:value="formData.contact_user_phone" />
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :span="24" :gutter="[24, 12]">
            <a-col :span="12">
              <a-form-item required label="联系地址" name="contact_address">
                <a-input v-model:value="formData.contact_address" />
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :span="24" :gutter="[24, 12]">
            <a-col :span="12">
              <a-form-item required label="注册地址" name="registered_address">
                <a-input v-model:value="formData.registered_address" />
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
        <div class="flex flex-row justify-end w-full">
          <a-button @click="handleCancelEvent">取消</a-button>
          <div class="w-[20px]"></div>
          <a-button @click="handleConfirmEvent" type="primary">确定</a-button>
        </div>
      </div>
    </template>
  </PageMain>
</template>

<script lang="ts" setup>
import { reactive } from 'vue';
import PageMain from '@/components/PageBox.vue';
import { useRouter } from 'vue-router';

const router = useRouter();

const formData = reactive({
  name: '',
  type: '',
  credit_code: '',
  contact_user_name: '',
  contact_user_phone: '',
  contact_address: '',
  registered_address: ''
});
// handleCancelEvent
const handleCancelEvent = () => {
  router.push({
    name: 'subject'
  });
};
// handleConfirmEvent
const handleConfirmEvent = () => {
  router.push({
    name: 'subject'
  });
};
</script>
